﻿<UserControl x:Class="MSDNWebcast.Views.Courses"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Controls="clr-namespace:MSDNWebcast.Controls">
    <UserControl.Resources>
        <ControlTemplate x:Key="SwithButtonTemplate" TargetType="{x:Type Button}">
            <Border Name="Border" Margin="0" CornerRadius="2" >
                <Grid Name="grid" Opacity="0.6">
                    <ContentPresenter Margin="6,0"  VerticalAlignment="Center" HorizontalAlignment="Center" />
                </Grid>
            </Border>
            <ControlTemplate.Triggers>
                <Trigger Property="IsEnabled" Value="False">
                    <Setter Property="Background" Value="{StaticResource backgroundNormal}" TargetName="Border"></Setter>
                    <Setter Property="Opacity" Value="1" TargetName="grid"></Setter>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1.2*"/>
            <ColumnDefinition Width="3*"/>
        </Grid.ColumnDefinitions>

        <DockPanel>
            <Border Name="searchBox" Opacity="1" Margin="0,20,0,5" Height="24"  DockPanel.Dock="Top">
                <Controls:SearchTextBox x:Name="txtSearch" BorderThickness="0" FontSize="14" Foreground="White" BorderBrush="Black" SearchEventTimeDelay="00:00:00.5"
                                        SearchCommand="{Binding Path=SearchCommand}" CommandParameter="{Binding Path=Text,  RelativeSource={RelativeSource Self}}"
                                        SearchMode="Instant" LabelText="搜索……" Background="{StaticResource backgroundNormal}">
                </Controls:SearchTextBox>
            </Border>
            <StackPanel DockPanel.Dock="Top" Margin="0,0,0,5" Height="24" HorizontalAlignment="Right" Orientation="Horizontal">
                <Button Cursor="Hand" Command="{Binding Path=SwithCommand}" IsEnabled="{Binding Path=EnableAllButton}"
                    Template="{StaticResource SwithButtonTemplate}">
                    <Image VerticalAlignment="Center" Width="12" Source="../Images/all.png"></Image>
                </Button>
                <Button Cursor="Hand" Command="{Binding Path=SwithCommand}" IsEnabled="{Binding Path=EnableDownloadButton}"
                    Template="{StaticResource SwithButtonTemplate}">
                    <Image VerticalAlignment="Center" Width="12" Source="../Images/down.png"></Image>
                </Button>
            </StackPanel>
            <Grid>
                <TextBlock HorizontalAlignment="Center" Margin="0,50,0,0" FontSize="14" Foreground="White" Text="{Binding Path=LeftViewInfomation}"></TextBlock>

                <ListBox ItemsSource="{Binding Path=Series}"
                     SelectedItem="{Binding Path=SelectedCourseCatalog, Mode=TwoWay}"
                 ItemContainerStyle="{StaticResource courseCatalogItem}" 
                 Style="{StaticResource courseCatalogListBox}">
                </ListBox>
            </Grid>
        </DockPanel>

        <TextBlock Grid.Column="1" HorizontalAlignment="Center" Margin="0,50,0,0" FontSize="14" Foreground="White" Text="{Binding Path=RightViewInfomation}"></TextBlock>

        <ListBox Grid.Column="1" Margin="20,20,0,0" ItemsSource="{Binding Path=Courses}" 
                 ItemContainerStyle="{StaticResource courseItem}" 
                 Style="{StaticResource courseListBox}">
        </ListBox>
    </Grid>
</UserControl>